package com.oz.entity;

import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.Comment;
import org.hibernate.annotations.Table;

import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;

@Entity(name = "basic_media")
@Table(appliesTo = "basic_media", comment = "图文对象, 其中 author字段为公众号tong")
@TableName("basic_media")
public class MediaEntity {

	@Id
	@Column(length = 32)
	private String id;


	// 图文消息的分类，带层级 为解析后js 多维数组。
	@Comment("图文的分类")
	@Column(length = 128)
	@TableField(value = "classify")
	@JSONField(name = "classify")
	private String classify;

	// 图文媒体标题
	@Comment("图文标题")
	@Column(nullable = false, length = 128)
	@TableField(value = "title")
	private String title;

	@Comment("导入图文作者使用，数据库不标记, 实际上用来存放 userEntity对应表的id, 因mybatis-plus没有 @ManyToOne, 同User配合使用")
	@Column(name = "author", length = 32)
	private String author;

	@Comment("图文消息的摘要(否)，仅有单图文消息才有摘要，多图文此处为空。如果本字段为没有填写，则默认抓取正文前54个字")
	@Column(length = 128)
	@TableField(value = "digest")
	private String digest;

	// 图文消息的具体内容，支持 HTML 标签，必须少于2万字符，小于1M，且此处会去除 JS ,涉及图片 url 必须来源
	// "上传图文消息内的图片获取URL"接口获取。外部图片 url 将被过滤。
	// 图文媒体内容,文本文件存放路径,相对路径
	@Comment("图文消息内容")
	@Column(length = 256)
	@TableField(value = "content")
	private String content;

	// 图文消息的原文地址(否)，即点击“阅读原文”后的URL
	@Comment("图文消息网上链接，例如微信链接")
	@Column(name = "content_source_url", length = 256)
	@TableField(value = "content_source_url")
	@JSONField(name = "content_source_url")
	private String contentSourceUrl;

	// 封面，可以有多张封面，但是上传微信公众号，仅支持第一张
	@Comment("封面地址")
	@Column(length = 256)
	@TableField(value = "thumbs")
	private String thumbs;

	// 封面图片素材id(必须是永久MediaID 上传到微信公众号-素材 必须的
	@Comment("图文消息 微信链接")
	@Column(name = "thumb_media_id", length = 64)
	@TableField(value = "thumb_media_id")
	@JSONField(name = "thumb_media_id")
	private String thumbMediaId;

	// Uint32 是否打开评论(否)，0不打开(默认)，1打开
	@Column(name = "need_open_comment")
	@TableField(value = "need_open_comment")
	@JSONField(name = "need_open_comment")
	private Integer needOpenComment;

	// Uint32 是否粉丝才可评论(否)，0所有人可评论(默认)，1粉丝才可评论
	@Column(name = "only_fans_can_comment")
	@TableField(value = "only_fans_can_comment")
	@JSONField(name = "only_fans_can_comment")
	private Integer onlyFansCanComment;

	@Comment("创建时间")
	@Column(name = "create_time")
	@TableField(value = "create_time")
	@JSONField(name = "createTime", format = "yyyy-MM-dd HH:mm:ss")
	private Timestamp createTime;

	@Comment("修改时间")
	@Column(name = "update_time")
	@TableField(value = "update_time")
	@JSONField(name = "updateTime", format = "yyyy-MM-dd HH:mm:ss")
	private Timestamp updateTime;


	@Comment("文章状态，草稿|发布未上传|发布已上传|下架未上传|下架已上传")
	@Column(length = 8)
	@TableField(value = "status")
	private String status;

	// 文章的归类, 用于区分文章类型，例如 实时新闻， 综合分析，等等
	@Comment("备注")
	@Column(length = 32)
	@TableField(value = "remark")
	private String remark;

//	@Transient
	@ManyToOne
	@JoinColumn(name = "user_id" ,referencedColumnName = "id")
	@JSONField(name = "user")
	private UserEntity user;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getClassify() {
		return classify;
	}

	public void setClassify(String classify) {
		this.classify = classify;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public String getDigest() {
		return digest;
	}

	public void setDigest(String digest) {
		this.digest = digest;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getContentSourceUrl() {
		return contentSourceUrl;
	}

	public void setContentSourceUrl(String contentSourceUrl) {
		this.contentSourceUrl = contentSourceUrl;
	}

	public String getThumbs() {
		return thumbs;
	}

	public void setThumbs(String thumbs) {
		this.thumbs = thumbs;
	}

	public String getThumbMediaId() {
		return thumbMediaId;
	}

	public void setThumbMediaId(String thumbMediaId) {
		this.thumbMediaId = thumbMediaId;
	}

	public Integer getNeedOpenComment() {
		return needOpenComment;
	}

	public void setNeedOpenComment(Integer needOpenComment) {
		this.needOpenComment = needOpenComment;
	}

	public Integer getOnlyFansCanComment() {
		return onlyFansCanComment;
	}

	public void setOnlyFansCanComment(Integer onlyFansCanComment) {
		this.onlyFansCanComment = onlyFansCanComment;
	}

	public Timestamp getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	public Timestamp getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Timestamp updateTime) {
		this.updateTime = updateTime;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public UserEntity getUser() {
		return user;
	}

	public void setUser(UserEntity user) {
		this.user = user;
	}
	
	

}
